package com.dianxin.smartpark.web.common;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.common.SmartParkCardQO;
import com.dianxin.smartpark.service.common.SmartParkCardService;
import com.dianxin.smartpark.service.vo.common.SmartParkCardVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 卡务管理
 * 
 * @author chenjiasong
 * @date 2021-07-28
 */
@RestController
@RequestMapping("/smartpark/card")
public class SmartParkCardController
{
    @Resource
    private SmartParkCardService smartParkCardService;

    /**
     * 查询卡务管理列表
     */
    @GetMapping("/list")
    @SaCheckPermission("/smartpark/card/list")
    public CommonResponseBody<List<SmartParkCardVO>>  list(SmartParkCardQO qo)
    {
        return smartParkCardService.selectSmartParkCardList(qo);
    }


    /**
     * 获取卡务管理详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission("/smartpark/card/getInfo")
    public CommonResponseBody<SmartParkCardVO> getInfo(SmartParkCardQO qo)
    {
        return smartParkCardService.selectSmartParkCard(qo);
    }

    /**
     * 新增卡务管理
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/card/add")
    @RecordLog(name = "新增卡务管理")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkCardVO vo)
    {
        return smartParkCardService.insertSmartParkCard(vo);
    }

    /**
     * 修改卡务管理
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/card/edit")
    @RecordLog(name = "修改卡务管理")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkCardVO vo) throws Exception {
        return smartParkCardService.updateSmartParkCard(vo);
    }

    /**
     * 删除卡务管理
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/card/remove")
    @RecordLog(name = "删除卡务管理")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkCardVO vo)
    {
        return smartParkCardService.deleteSmartParkCard(vo);
    }
}
